package com.slz3.business.module.financeManagement.finFinanceManage.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.financeManagement.finFinanceManage.domain.FinFinanceManage;
import com.slz3.business.module.financeManagement.finFinanceManage.domain.FinFinanceManageFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class FinFinanceManageTransactionalServiceImpl implements FinFinanceManageTransactionalService {

    @Override
    public FinFinanceManage modify(FinFinanceManage finFinanceManageNew) {
        Repositorys.finFinanceManage.test();
        Repositorys.finFinanceManage.save(FinFinanceManageFactory.initBaseFields());
        System.err.println(1 / 0);
        finFinanceManageNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.finFinanceManage.saveAndFlush(finFinanceManageNew);
    }

    @Override
    public List<FinFinanceManage> batchModify(List<FinFinanceManage> finFinanceManageList) {
        return Repositorys.finFinanceManage.saveAll(finFinanceManageList);
    }
}
